<%@page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	String url = basePath + "active_";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="<%=basePath%>public/css/bootstrap.min.css">
<link rel="stylesheet" href="<%=basePath%>public/css/common.css">
<link rel="stylesheet" type="text/css"
	href="<%=basePath%>public/css/loading.css">
<script src="<%=basePath%>public/js/jquery-2.1.4.min.js"></script>
<script src="<%=basePath%>public/js/bootstrap.min.js"></script>
<script src="<%=basePath%>public/js/schedule.js"></script>
<link rel="stylesheet"
	href="https://at.alicdn.com/t/font_234130_nem7eskcrkpdgqfr.css">
<script type="text/javascript"
	src="<%=basePath%>public/js/my_loading.js"></script>
<script type="text/javascript">
	$(function() {
		$("a").click(function (){
			$("#loadingDialog").css("display", "block");
		});
				$.ajax({
                type: "GET",
                url: "<%=basePath%>user_wlist",
			dataType : "json",
			success : function(data) {
				if (data.success) {
					for (var i = 0; i < data.datas.length; i++) {
						var user = data.datas[i];
						var content = "<option value='"+user.id+"'>"
								+ user.name + "</option>";
						$("#userId").append(content);
					}
				} else {
					alert("拉取数据失败!");
				}
				$("#userId").val($("#user").val());
				if ($("#user").val() != null && $("#user").val() != "") {
					$("#userId").attr("disabled", true);
				}
			},
			error : function(result, status) {
				alert("网络错误!");
			}
		});
			$.ajax({
                type: "GET",
                url: "<%=basePath%>active_wlist",
			dataType : "json",
			success : function(data) {
				if (data.success) {
					for (var i = 0; i < data.datas.length; i++) {
						var active = data.datas[i];
						var content = "<option value='"+active.id+"'>"
								+ active.name + "</option>";
						$("#activeId").append(content);
					}
				} else {
					alert("拉取数据失败!");
				}
				$("#activeId").val($("#active").val());
				if ($("#active").val() != null && $("#active").val() != "") {
					$("#activeId").attr("disabled", true);
				}
			},
			error : function(result, status) {
				alert("网络错误!");
			}
		});
	});
</script>
</head>
<body>
	<ol class="breadcrumb">
		<li><a href="#">活动管理</a></li>
		<li class="active">人员编辑</li>
	</ol>
	<div class="panelBox">
		<div class="title"></div>
		<div class="form">
			<form class="form-horizontal" role="form" action="<%=url%>save"
				method="post">
				<input type="hidden" name="activeRecord.id" id="id"
					value="${activeRecord.id}" /> <input type="hidden" id="user"
					value="${activeRecord.user.id}" />
					<input type="hidden" id="active"
					value="${activeRecord.active.id}" /> <input type="hidden"
					name="activeRecord.joinTime" value="${activeRecord.joinTime}" />
				<div class="form-group">
					<label for="userId" class="col-sm-2 control-label">用户</label>
					<div class="col-sm-10" >
						<select id="userId" name="userId" class="form-control">
						</select>
					</div>
				</div>
				<div class="form-group">
					<label for="activeId" class="col-sm-2 control-label">活动</label>
					<div class="col-sm-10">
						<select id="activeId" name="activeId" class="form-control">
						</select>
					</div>
				</div>

				<div class="form-group">
					<div class="col-sm-offset-2 col-sm-10">
						<button type="submit" class="btn btn-primary btn-sm">提交</button>
						<button type="button" style="margin-left: 20px;"
							onclick="javascript:history.go(-1);"
							class="btn btn-default btn-sm">返回</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</body>
</html>